<?php

	$content = 'edit_seller.php';
	$include='
		<link rel="stylesheet" type="text/css" href="'.W_ROOT.'/css/mStyle.css">
		<script src="'.W_ROOT.'/js/jquery.js" type="text/javascript"></script>
	';
	require_once TMP_USER_PATH;
	$start = '<span class="coloRed">*</span>';
	$error = isset($_GET['error'])?$_GET['error']:'';
	
	$editRow="SELECT tbluser.id, tbluser_profile.first_name AS fname, 
tbluser_profile.last_name AS lname, 
tbluser.email AS uemail, 
tbluser_profile.phone AS uphone, 
tbluser_profile.mobile AS umobile, 
tbluser_profile.address AS uaddress, 
tbluser.country_id,  
zip,
city,
region,
title 
FROM tbluser
INNER JOIN tbluser_profile ON tbluser.id = tbluser_profile.provider
WHERE tbluser.id=".$_SESSION['acc_id'];
	$query=mysql_query($editRow);
	
	$result=mysql_fetch_array($query);
	$success = isset($_GET['success'])?$_GET['success']:'';	
        
        //////////////////////////test////////////////////////
        //print $_SESSION['acc_id'];
        //echo $product_id;
	
?>
<?php
	$var = '<span style="color:#F00">*</span>';
       $_SESSION['profile_shipping_email']=  $result['uemail'];
?>
<script>
	function sh_firstname()
	{
		var x=document.forms["frmCheckout"]["txtShippingFirstName"].value
		if (x==null || x=="")
		{
			document.getElementById("a1").innerHTML = "Please input first name!";
		}else{
			document.getElementById("a1").innerHTML = "";
		}
	}
	function sh_lastname()
	{
		var x=document.forms["frmCheckout"]["txtShippingLastName"].value
		if (x==null || x=="")
		{
			document.getElementById("a2").innerHTML = "Please input last name!";
		}else{
			document.getElementById("a2").innerHTML = "";
		}
	}
	function sh_address()
	{
		var x=document.forms["frmCheckout"]["txtShippingAddress"].value
		if (x==null || x=="")
		{
			document.getElementById("a3").innerHTML = "Please input Street address!";
		}else{
			document.getElementById("a3").innerHTML = "";
		}
	}
	function sh_phone()
	{
		var x=document.forms["frmCheckout"]["txtShippingPhone"].value
		if (x==null || x=="")
		{
			document.getElementById("a4").innerHTML = "Please input phone number!";
		}else{
			document.getElementById("a4").innerHTML = "";
		}
	}
	function sh_mobile()
	{
		var x=document.forms["frmCheckout"]["txtShippingMobile"].value
		if (x==null || x=="")
		{
			document.getElementById("a5").innerHTML = "Please input mobile number!";
		}else{
			document.getElementById("a5").innerHTML = "";
		}
	}
	function sh_email()
	{
		var x=document.forms["frmCheckout"]["txtShippingEmail"].value
		if (x==null || x=="")
		{
			document.getElementById("a6").innerHTML = "Please input email!";
                }
//                else if(x!="$result['uemail']")
//                {
//                        document.getElementById("a6").innerHTML = "Please input email as your profile email!";
//                        
//		}
                else{
			document.getElementById("a6").innerHTML = "";
		}
	}
	function sh_state()
	{
		var x=document.forms["frmCheckout"]["txtShippingState"].value
		if (x==null || x=="")
		{
			document.getElementById("a7").innerHTML = "Please input province / state!";
		}else{
			document.getElementById("a7").innerHTML = "";
		}
	}
	function sh_city()
	{
		var x=document.forms["frmCheckout"]["txtShippingCity"].value
		if (x==null || x=="")
		{
			document.getElementById("a8").innerHTML = "Please input city!";
		}else{
			document.getElementById("a8").innerHTML = "";
		}
	}
	function sh_country()
	{
		var x=document.forms["frmCheckout"]["txtShippingCountry"].value
		if (x==null || x=="")
		{
			document.getElementById("a9").innerHTML = "Please input country!";
		}else{
			document.getElementById("a9").innerHTML = "";
		}
	}
	function sh_zip()
	{
		var x=document.forms["frmCheckout"]["txtShippingPostalCode"].value
		if (x==null || x=="")
		{
			document.getElementById("a10").innerHTML = "Please input postal / zip Code!";
		}else{
			document.getElementById("a10").innerHTML = "";
		}
	}
	function pay_firstname()
	{
		var x=document.forms["frmCheckout"]["txtPaymentFirstName"].value
		if (x==null || x=="")
		{
			document.getElementById("b1").innerHTML = "Please input first name!";
		}else{
			document.getElementById("b1").innerHTML = "";
		}
	}
	function pay_lastname()
	{
		var x=document.forms["frmCheckout"]["txtPaymentLastName"].value
		if (x==null || x=="")
		{
			document.getElementById("b2").innerHTML = "Please input last name!";
		}else{
			document.getElementById("b2").innerHTML = "";
		}
	}
	function pay_address()
	{
		var x=document.forms["frmCheckout"]["txtPaymentAddress"].value
		if (x==null || x=="")
		{
			document.getElementById("b3").innerHTML = "Please input Street address!";
		}else{
			document.getElementById("b3").innerHTML = "";
		}
	}
	function pay_phone()
	{
		var x=document.forms["frmCheckout"]["txtPaymentPhone"].value
		if (x==null || x=="")
		{
			document.getElementById("b4").innerHTML = "Please input phone number!";
		}else{
			document.getElementById("b4").innerHTML = "";
		}
	}
	function pay_mobile()
	{
		var x=document.forms["frmCheckout"]["txtPaymentMobile"].value
		if (x==null || x=="")
		{
			document.getElementById("b5").innerHTML = "Please input mobile number!";
		}else{
			document.getElementById("b5").innerHTML = "";
		}
	}
	function pay_email()
	{
		var x=document.forms["frmCheckout"]["txtPaymentEmail"].value
		if (x==null || x=="")
		{
			document.getElementById("b6").innerHTML = "Please input email!";
		}else{
			document.getElementById("b6").innerHTML = "";
		}
	}
	function pay_state()
	{
		var x=document.forms["frmCheckout"]["txtPaymentState"].value
		if (x==null || x=="")
		{
			document.getElementById("b7").innerHTML = "Please input province / state!";
		}else{
			document.getElementById("b7").innerHTML = "";
		}
	}
	function pay_city()
	{
		var x=document.forms["frmCheckout"]["txtPaymentCity"].value
		if (x==null || x=="")
		{
			document.getElementById("b8").innerHTML = "Please input city!";
		}else{
			document.getElementById("b8").innerHTML = "";
		}
	}
	function pay_country()
	{
		var x=document.forms["frmCheckout"]["txtPaymentCountry"].value
		if (x==null || x=="")
		{
			document.getElementById("b9").innerHTML = "Please input country!";
		}else{
			document.getElementById("b9").innerHTML = "";
		}
	}
	function pay_zip()
	{
		var x=document.forms["frmCheckout"]["txtPaymentPostalCode"].value
		if (x==null || x=="")
		{
			document.getElementById("b10").innerHTML = "Please input postal / zip Code!";
		}else{
			document.getElementById("b10").innerHTML = "";
		}
	}
</script>
<script language="JavaScript" type="text/javascript" src="js/checkout.js"></script>


<div class="row">
	<div class="box">
<div class="title"><!--Step 1 Of 3 : Enter Shipping And Payment Information--><?php echo $lang['SHIP_FIRST_INFO'];?> </div>
<div class="center">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?step=2" method="post" name="frmCheckout" id="frmCheckout" onSubmit="return checkShippingAndPaymentInfo();">
	<table cellpadding="5" cellspacing="5" align="center" width="100%">
    	<tr>
            <td colspan="2">
               <div style="float:left; width:35%;"><span style="color:#417EFB; font-size:18px;"><!--Shipping Information--><?php echo $lang['SHIP_INFOMATION'];?></span></div>
               <div style="float:right;"><span class="coloRed"><!--Note : All (*) are required--><?php echo $lang['SHIP_REQUIRED'];?></span></div>
            </td>
       	</tr>
    	<tr>
        	<td><!--First Name--><?php echo $lang['SHIP_FIR_NAME'];?> <?php echo $var; ?></td>
            <td> : <input value="<?php echo $result['fname']; ?>" type="text" name="txtShippingFirstName" id="txtShippingFirstName" onblur="sh_firstname()"/></td>
        </tr>
        <tr><td colspan="2" id="a1" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Last Name--><?php echo $lang['SHIP_LAS_NAME'];?> <?php echo $var; ?></td>
            <td> : <input value="<?php echo $result['lname']?>" type="text" name="txtShippingLastName" id="txtShippingLastName" onblur="sh_lastname()"/></td>
        </tr>
        <tr><td colspan="2" id="a2" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><label for="selShippingTitle"><!--Title --><?php echo $lang['SHIP_TITLE'];?><?php echo $var; ?></label></td>
            <td>: <select id="selShippingTitle" name="selShippingTitle">
                	<option selected="selected"><!--Please select one--><?php echo $lang['PAY_SELECT_ONE'];?></option>                   
                    <option <?php echo($result['title']=="Mr.")?' selected="selected"':''?>>Mr.</option>
                    <option <?php echo($result['title']=="Mrs.")?' selected="selected"':''?>>Mrs.</option>
                    <option <?php echo($result['title']=="Miss.")?' selected="selected"':''?>>Miss.</option>
                </select>
            </td>
        </tr>
        <tr><td></td></tr>        
        <tr>
        	<td><!--Telephone--><?php echo $lang['SHIP_PHONE'];?> <?php echo $var;?></td>
            <td> : <input value="<?php echo $result['uphone']?>" type="text" name="txtShippingPhone" id="txtShippingPhone" onblur="sh_phone()"/></td>
        </tr>
        <tr><td colspan="2" id="a4" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Mobile Phone--><?php echo $lang['SHIP_MPHONE'];?> <?php echo $var;?></td>
            <td> : <input value="<?php echo $result['umobile']?>" type="text" name="txtShippingMobile" id="txtShippingMobile" onblur="sh_mobile()"/></td>
        </tr>
        <tr><td colspan="2" id="a5" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Email--> <?php echo $lang['SHIP_EMAIL'];?><?php echo $var;?></td>
            <td> : <input value="<?php echo $result['uemail']?>" type="text" name="txtShippingEmail" id="txtShippingEmail" onblur="sh_email()"/></td>
        </tr>
        <tr><td colspan="2" id="a6" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Street--> <?php echo $lang['SHIP_STREET'] ;?><?php echo $var;?></td>
            <td> : <input value="<?php echo $result['uaddress']?>" type="text" name="txtShippingAddress" id="txtShippingAddress" onblur="sh_address()"/></td>
        </tr>
        <tr><td colspan="2" id="a3" style="color:#F00; font-style:italic;"></td></tr>
        <tr>        
        	<td><!--Province / State--><?php echo $lang['SHIP_PRO_STATE'];?> <?php echo $var; ?></td>
            <td> : <input value="<?php echo $result['region']?>" type="text" name="txtShippingState" id="txtShippingState" onblur="sh_state()"/></td>
        </tr>
        <tr><td colspan="2" id="a7" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--City--><?php echo $lang['SHIP_CITY'];?> <?php echo $var; ?></td>
            <td> : <input value="<?php echo $result['city']?>" type="text" name="txtShippingCity" id="txtShippingCity" onblur="sh_city()"/></td>
        </tr>
        <tr><td colspan="2" id="a8" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Country--> <?php echo $lang['SHIP_COUNTRY'];?><?php echo $var;?></td>
            <td> : <select id="txtShippingCountry" name="txtShippingCountry" class="b" onclick="editSeller();">
                        	<?php
								$str = "SELECT id, country_name from tblcountries order by country_name";
								$query = mysql_query($str);
								$num_rows = mysql_num_rows($query);
								while($data = mysql_fetch_array($query)){
							?>
                            <option value="<?php echo $data['id'];?>" <?php echo($data['id']==$result['country_id'])?' selected="selected"':''?>><?php echo $data['country_name']; ?></option>
                            <?php
							}
							?>
                      	</select></td>
        </tr>
        <tr><td colspan="2" id="a9" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Postal / Zip Code--><?php echo $lang['SHIP_ZIP_CODE'];?> <?php echo $var;?></td>
            <td> : <input value="<?php echo $result['zip']?>" type="text" name="txtShippingPostalCode" id="txtShippingPostalCode" onblur="sh_zip()"/></td>
        </tr>
        <tr><td colspan="2" id="a10" style="color:#F00; font-style:italic;"></td></tr>
    </table>
	<table cellpadding="5" cellspacing="5" align="center" width="100%">
    	<tr>
            <td colspan="2">
               <div style="float:left; width:35%"><span style="color:#417EFB; font-size:18px;"><!--Payment Information--><?php echo $lang['PAY_PAYMENT_INFORMATION'];?></span></div>
               <label for="chkSame" style="cursor:pointer; font-weight:bold">               
               <input type="checkbox" name="chkSame" id="chkSame" value="chkSame" onClick="setPaymentInfo(this.checked)";/> <!--Same as shipping information--><?php echo $lang['PAY_SAME_SHOP_INFO'];?>
        		</label>
            </td>
       	</tr>
    	<tr>
        	<td><!--First Name--><?php echo $lang['SHIP_FIR_NAME'];?> <?php echo $var; ?></td>
            <td> : <input type="text" name="txtPaymentFirstName" id="txtPaymentFirstName" onblur="pay_firstname()"/></td>
        </tr>
        <tr><td colspan="2" id="b1" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Last Name--><?php echo $lang['SHIP_LAS_NAME'];?> <?php echo $var; ?></td>
            <td> : <input type="text" name="txtPaymentLastName" id="txtPaymentLastName" onblur="pay_lastname()"/></td>
        </tr>
        <tr><td colspan="2" id="b2" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><label for="selPaymentTitle"><!--Title--> <?php echo $lang['SHIP_TITLE'];?><?php echo $var; ?></label></td>
            <td>: <select id="selPaymentTitle" name="selPaymentTitle">
                	<option selected="selected"><!--Please select one--><?php echo $lang['PAY_SELECT_ONE'];?></option>
                    <option>Mr.</option>
                    <option>Mrs.</option>
                    <option>Miss.</option>
                </select>
            </td>
        </tr>
        <tr><td></td></tr>
        <tr>
        	<td><!--Telephone--><?php echo $lang['SHIP_PHONE'];?> <?php echo $var;?></td>
            <td> : <input type="text" name="txtPaymentPhone" id="txtPaymentPhone" onblur="pay_phone()"/></td>
        </tr>
        <tr><td colspan="2" id="b4" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Mobile Phone--> <?php echo $lang['SHIP_MPHONE'];?><?php echo $var;?></td>
            <td> : <input type="text" name="txtPaymentMobile" id="txtPaymentMobile" onblur="pay_mobile()"/></td>
        </tr>
        <tr><td colspan="2" id="b5" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Email--> <?php echo $lang['SHIP_EMAIL'];?><?php echo $var;?></td>
            <td> : <input type="text" name="txtPaymentEmail" id="txtPaymentEmail" onblur="pay_email()"/></td>
        </tr>
        <tr><td colspan="2" id="b6" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
        	<td><!--Street--><?php echo $lang['SHIP_STREET'];?> <?php echo $var;?></td>
            <td> : <input type="text" name="txtPaymentAddress" id="txtPaymentAddress" onblur="pay_address()"/></td>
        </tr>
        <tr><td colspan="2" id="b3" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Province / State --><?php echo $lang['SHIP_PRO_STATE'];?><?php echo $var; ?></td>
            <td> : <input type="text" name="txtPaymentState" id="txtPaymentState" onblur="pay_state()"/></td>
        </tr>
        <tr><td colspan="2" id="b7" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--City--><?php echo $lang['SHIP_CITY'];?> <?php echo $var; ?></td>
            <td> : <input type="text" name="txtPaymentCity" id="txtPaymentCity" onblur="pay_city()"/></td>
        </tr>
        <tr><td colspan="2" id="b8" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Country--><?php echo $lang['SHIP_COUNTRY'];?> <?php echo $var;?></td>
            <td> : <input type="text" name="txtPaymentCountry" id="txtPaymentCountry" onblur="pay_country()"/></td>
        </tr>
        <tr><td colspan="2" id="b9" style="color:#F00; font-style:italic;"></td></tr>
        <tr>
        	<td><!--Postal / Zip Code--><?php echo $lang['SHIP_ZIP_CODE'];?> <?php echo $var;?></td>
            <td> : <input type="text" name="txtPaymentPostalCode" id="txtPaymentPostalCode" onblur="pay_zip()"/></td>
        </tr>
        <tr><td colspan="2" id="b10" style="color:#F00; font-style:italic;"></td></tr>
    </table>
    <div class="row">
    	<div class="six columns">
   <!-- Payment Method --><?php echo $lang['PAY_METHOD'];?>
    	</div>
        <div class="six columns">
        <label class="radio">
        <input name="optPayment" type="radio" id="optPaypal" value="paypal" checked="checked" />
        <!--Paypal--><?php echo $lang['PAY_PAYPAL'];?></label>
        <label class="radio">
        <input name="optPayment" type="radio" value="cod" id="optCod" />
        <!--Cash on Delivery--><?php echo $lang['PAY_DELIVERY'];?></label>
        </div>
	</div>        
        

    <p>&nbsp;</p>
        <p align="center"> 
        <input name="btnStep1" type="submit" id="btnStep1" value="<?php echo $lang['PAY_PROCEED'];?> &gt;&gt;">
    </p>
</form>
</div>

	</div><!--<div class="box">-->
</div> <!--<div class="row">-->